import pygame
from outman_global import *


class CPlayer(pygame.sprite.Sprite):

    def __init__(self):
        pygame.sprite.Sprite.__init__(self,self.containers)
        self.image = self.images[0]
        self.rect = self.image.get_rect(midbottom = [player_init_pos_x,player_init_pos_y])
        self.xspeed = 0
        self.yspeed = 0

    def update(self):
        self.rect.move_ip(self.xspeed,self.yspeed)
        self.rect = self.rect.clamp(screen_rect)
        
        
    def set_xspeed(self,x):
        self.xspeed = x

    def set_yspeed(self,y):
        self.yspeed = y

    def get_xspeed(self):
        return self.xspeed

    def get_yspeed(self):
        return self.yspeed
    
    def move(self,x_offset,y_offset):
        self.rect.move_ip(x_offset,y_offset)

    def get_xpos(self):
        return self.rect[0]

    def get_ypos(self):
        return self.rect[1]
